# !/usr/bin python3
# encoding: utf-8 -*-
# @file     : coupons_apis.py
# @author   : 沙陌 Matongxue_2
# @Time     : 2023/8/22 20:54
# @Copyright: 北京码同学
from api.base_api import BaseSellerApi
from common.random_util import gen_timestamp


class AddCouponsApi(BaseSellerApi):
    """
    添加优惠券
    """
    def __init__(self):
        super().__init__()
        self.url = f'{self.host}/seller/promotion/coupons'
        self.method = 'post'
        self.data={
            "title": "assss",
            "coupon_price": 10,
            "coupon_threshold_price": 111,
            "create_num": 11111,
            "limit_num": 1,
            "type": "FREE_GET",
            "start_time": gen_timestamp('+1d','+2d'),
            "end_time": gen_timestamp('+6d','+7d')
        }
class ChangeCouponsApi(BaseSellerApi):
    """
    修改优惠券
    """
    def __init__(self,coupon_id):
        super().__init__()
        self.url = f'{self.host}/seller/promotion/coupons/{coupon_id}'
        self.method = 'put'
        self.data={
            "title": "assss",
            "coupon_price": 10,
            "coupon_threshold_price": 111,
            "create_num": 11111,
            "limit_num": 1,
            "type": "FREE_GET",
            "start_time": gen_timestamp('+1d','+2d'),
            "end_time": gen_timestamp('+6d','+7d')
        }
class GetCouponsByIdApi(BaseSellerApi):
    """
    修改优惠券
    """
    def __init__(self,coupon_id):
        super().__init__()
        self.url = f'{self.host}/seller/promotion/coupons/{coupon_id}'
        self.method = 'get'
class DeleteCouponsByIdApi(BaseSellerApi):
    """
    修改优惠券
    """
    def __init__(self,coupon_id):
        super().__init__()
        self.url = f'{self.host}/seller/promotion/coupons/{coupon_id}'
        self.method = 'delete'